layui.use(['element','layer'], function() {
    var element = layui.element;
    var layer = layui.layer; 
    $(function () {
        var firstMenu=$(".layui-nav li:first");
        var firstTitle=firstMenu.text();
        var firstInfo=firstMenu.attr("data-info");
        element.on('nav(main_nav)', function(elem){
            var title=$(elem).text();
            var info=$(elem).attr("data-info");
            $(".header-left-title").text(title);
            if (title==firstTitle){
                $(".header-left-info").text(firstInfo);
            }else{
                $(".header-left-info").text(info);
            }
            var parentFirstText=$(elem).parent().parent().children("a").text();
            var parentSecondText=$(elem).text();
            $(".layui-breadcrumb").html("<a href=''>"+parentFirstText+"</a><a><cite>"+parentSecondText+"</cite></a>");
            element.render();
        });
        
        $.ajax({
			url:"menuClassQuery",
			type:"GET",
			success:function(res){
				if (res.success) {
					$("#menuClassQuery").append(res.data.html);
					element.render();
				}
			}
		});
        
        $("#loginOut").click(function(){
        	layer.confirm("确定退出吗？",["确定"],function(){
        		window.location="loginOut";
        	});
        });
        
    });
});